package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.service.ShopService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*;

@RestController("adminShopController")
@RequestMapping("/admin/shop")
@Slf4j
@Api(tags = "店铺相关接口")
public class ShopController {
    @Autowired
    private ShopService shopService;

    @ApiOperation("设置营业状态")
    @PutMapping("/{status}")
    public Result starOrStop(@PathVariable("status") Integer status){
        log.info("将店铺状态更改为:{}",status==1?"营业中":"打样中");
        shopService.changeStatus(status);
        return Result.success();
    }

    @ApiOperation("获取营业状态")
    @GetMapping("/status")
    public Result<Integer> getStatus(){
        Integer status = shopService.getStatus();
        log.info("管理端查看店铺状态:{}",status==1?"营业中":"打样中");
        return Result.success(status);
    }




}
